package com.hyt.it.ogt.ks.feign.model.es;

import java.time.LocalDateTime;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.hyt.it.ogt.ks.feign.model.ExamCandidate;
import com.hyt.it.ogt.ks.model.entity.CandidateLogOther;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 考试异常管理索引
 *
 * @author zhoumiao
 * @since 2022/11/23
 */
@Data
public class EsExceptionManageRecord {
    @NotBlank(message = "id不能为空")
    @ApiModelProperty(value = "考试异常记录表id")
    private String id;

    @NotBlank(message = "考试id不能为空")
    @ApiModelProperty(value = "考试id")
    private String examId;

    @NotBlank(message = "考试考生id不能为空")
    @ApiModelProperty(value = "考试考生id")
    private String examCandidateId;

    @NotBlank(message = "准考证号不能为空")
    @ApiModelProperty(value = "准考证号")
    private String admissionNumber;

    @NotBlank(message = "学生姓名不能为空")
    @ApiModelProperty(value = "学生姓名")
    private String name;

    @ApiModelProperty(value = "手机号")
    private String phone;

    @ApiModelProperty(value = "身份证")
    private String cardNumber;

    @NotNull(message = "操作类型不能为空")
    //@Min(value = 401,message = "操作类型码只能是401-409")
    //@Max(value = 409, message = "操作类型码只能是401-409")
    @ApiModelProperty(value = "操作类型")
    private Integer operateType;

    @ApiModelProperty(value = "审核状态")
    private Integer state;

    @NotNull(message = "操作时间不能为空")
    @ApiModelProperty(value = "操作时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime operateDateTime;

    @NotNull(message = "操作人名称不能为空")
    @ApiModelProperty(value = "操作人名称")
    private String operatorName;

    @NotNull(message = "操作人id不能为空")
    @ApiModelProperty(value = "操作人id")
    private String operatorId;

    @ApiModelProperty(value = "审核结果消息发送给学生状态 0-未发送 1-发送中")
    private Integer msgState;

    public EsExceptionManageRecord() {
    }

    public EsExceptionManageRecord(CandidateLogOther candidateLogOther, ExamCandidate examCandidate) {
        this.id = candidateLogOther.getId();
        this.examId = candidateLogOther.getExamId();
        this.examCandidateId = candidateLogOther.getCandidateId();
        this.admissionNumber = examCandidate.getAdmissionNumber();
        this.phone = examCandidate.getPhone();
        this.cardNumber = examCandidate.getCardNumber();
        this.name = examCandidate.getName();
        this.operateType = candidateLogOther.getOperateType();
        this.operateDateTime = candidateLogOther.getBeginTime();
        this.operatorId = candidateLogOther.getOperateUser();
    }
}
